package com.letoken.platform.repo.web3.provider;

import com.letoken.platform.pub.res.token.TokenErc20TxRes;
import com.letoken.platform.pub.res.token.TokenTxRes;
import com.letoken.platform.repo.web3.util.OkcScanUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * @author letokenlabs
 * @date 2022/12/14$
 * Free Plan >> 5 calls/second limit,Up to 100,000 API calls/day
 */
@Slf4j
@Component
public class OkcProvider extends EvmBaseProvider {

    @Override
    public List<TokenErc20TxRes> getTokenErc20Txs(String contractAddress, String walletAddress, Integer page, Integer pageSize, String sort) {
        try {
            return OkcScanUtil.getTokenErc20Txs(provider, contractAddress, walletAddress,page, pageSize, sort);
        }
        catch (Exception ex){
            return null;
        }
    }

    @Override
    public List<TokenTxRes> getTokenTxs(String walletAddress, Integer page, Integer pageSize, String sort) {
        try {
            return OkcScanUtil.getTokenTxs(provider, walletAddress, page, pageSize, sort);
        }
        catch (Exception ex){
            return null;
        }
    }
}
